If a third grader hangs around third graders all day in school then I would expect those would be his friends. Until he starts participating in activities where kids participate in where the grades get mixed (ie. school basketball team). This seems entirely appropriate to me.
And you're comparing public schools to prison? Remote learning for all of them would fix this?