Is this to much

Should i script it this way or should i just make a prefab already set up?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody2D))]
[RequireComponent(typeof(BoxCollider2D))]
public class RoomSpawn : MonoBehaviour
{
    Rigidbody2D rb;
    BoxCollider2D bc;
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        rb.isKinematic = true;
        bc = GetComponent<BoxCollider2D>();
        bc.isTrigger = true;
        gameObject.tag = "RoomSpawner";
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

It depends.

What if you’ll have 20 of these objects in the scene, and you decide to change some settings of the rigidbodies?

With the initialization like this you’ll just change one script and tha’s all. While with the prefab you’ll need to reload prefabs for every object or manually change setting on every object. (Don’t quote me here, I don’t know much about prefabs actually, but I think that’s how they work).

I always prefer to have code instead of prefabs and other “visual-programming” whistles. For me the code is much more convenient in most cases.

But yeah, when you have some particular parts of the project already set up, and almost finished, then you could make prefabs to put them on the scene in “ready-to-go” state. But in the ongoing developement process? Nah, prefabs are definitely one of the most unconvenient and even useless things in this case.